<div id="article_rating">
	<h4>rating</h4>
	<?php if($article['Article']['rate_count'] > 0) : ?>
	<ul>
		<li>
			<strong>	
			<?php
				$rating = number_format($article['Article']['rate_sum'] / $article['Article']['rate_count'], 2);
				echo $rating;
			?>
			</strong>	
			by <?php echo $article['Article']['rate_count']?> users
		</li>
	</ul>
	<?php endif;?>
	
	<?php if(isset($ratingAdded)):?>
		<h4>your rating was added</h4>
	<?php endif;?>

<?php
	if($ratingAllowed):
		for($i = 1; $i <= 5; $i++) {
			echo '<span>'
					.$ajax->link($i, '/articles/rate/'.$article['Article']['id'].'/'.$i, array('update'=>'ajax_rate'))
		        .'</span>';
		}
	elseif($access < COMMENTER):
	?>
		<ul>
			<li><?php echo $html->link('Login to add rating', '/articles/rate/'.$article['Article']['id']);?></li>
		</ul>
	<?php
	endif;
?>
</div>